﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MMS.BLL;
using MMS.Model;

namespace MyMMS
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            string username = btnName.Text;
            string userpass = btnPass.Text;
            ///实例化 AdminService类
            AdminService adminSerivce = new AdminService();
            ///申明一个AdminInfo类型的变量 用来接收Login方法
            AdminInfo admin = adminSerivce.Login(username, userpass);
            if (admin != null)//判断是否查询到数据
            {
                ///如果查询到提示登录成功
                MessageBox.Show(@"登录成功,您的信息如下:编号:" + admin.AdminId + "登录名:" + admin.AdminName + "角色:" + admin.AdminRole);
                FormShouyin FS = new FormShouyin();
                FS.Show();
                this.Hide();
            }
            else
            {
                ///查询失败返回登录失败
                MessageBox.Show("登录失败，用户名或者密码错误");
            }
        }
    }
}
